<template>
  <div v-if="isLoading" class="tabler-loading-overlay">
    <div class="spinner-border text-primary" role="status">
      <span class="visually-hidden">Loading...</span>
    </div>
  </div>
</template>

<script setup>
import {defineExpose, ref} from "vue";

const isLoading = ref(false)

const openLoading = () => {
  isLoading.value = true;
};

// 确认动作
const closeLoading = () => {
  isLoading.value = false;
};

// 使用 defineExpose 暴露方法
defineExpose({
  openLoading, closeLoading
});

</script>

<style scoped>
.tabler-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
</style>